﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="MailParams.aspx.cs" Inherits="GreatB2C.Web.Manage.SystemSet.SiteInfo.MailParams" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>邮件参数配置</title>
    <link href="../../../App_Themes/AdminDefaultTheme/Guide.css" type="text/css" rel="stylesheet" />
    <link href="../../../App_Themes/AdminDefaultTheme/index.css" type="text/css" rel="stylesheet" />
    <link href="../../../App_Themes/AdminDefaultTheme/MasterPage.css" type="text/css" rel="stylesheet" />
    <link href="../../../App_Themes/AdminDefaultTheme/xtree.css" type="text/css" rel="stylesheet" />

    <script type="text/javascript" src="../../../Resource/Script/jquery-1.4.2.min.js"></script>

    <script src="../../../Resource/Script/jquery.validate.min.js" type="text/javascript"></script>

    <script type="text/javascript">
        function autoconfig() {
            var src = $("#txtMailFrom").val();

            $("#txtMailServer").val("smtp." + src.substring(src.indexOf('@') + 1));
        }

        $().ready(function() {
            // validate signup form on keyup and submit
            $("#form1").validate({
                rules: {
                    txtMailFrom: {
                        required: true
                        ,email:true
                    },
                    txtMailServer: {
                        required: true
                    },
                    txtPort: {
                        required: true
                    }
                },
                messages: {
                    txtMailFrom: {
                        required: "<font class='validatemsg'>* 请输入发送人邮箱</font>"
                        , email: "<font class='validatemsg'>* 请输入正确的邮箱地址</font>"
                    },
                    txtMailServer: {
                        required: "<font class='validatemsg'>* 请输入发送邮件服务器</font>"
                    },
                    txtPort: {
                        required: "<font class='validatemsg'>* 请输入端口号</font>"
                    }
                }
            });

            if ($("#chkCollocateCheckBox")[0].checked) {
                $("#chkCollocateCheckBox").bind("blur", autoconfig);
                autoconfig();
            }
            else {
                $("#chkCollocateCheckBox").unbind("blur", autoconfig);
            }
        });

        function changeauto(obj) {
            if (obj.checked) {
                $("#chkCollocateCheckBox").bind("blur", autoconfig);
                autoconfig();
            }
            else {
                $("#chkCollocateCheckBox").unbind("blur", autoconfig);
            }
        }

        function SelectCredential(obj) {
            if (obj.value == "1" || obj.value == "3") {
                $("#PalBasic").attr("disabled", "disabled");
                $("#txtMailServerUserName").attr("disabled", "disabled");
                $("#txtMailServerPassWord").attr("disabled", "disabled");
            }
            else {
                $("#PalBasic").removeAttr("disabled");
                $("#txtMailServerUserName").removeAttr("disabled");
                $("#txtMailServerPassWord").removeAttr("disabled");
            }
        }
    </script>

</head>
<body>
    <form id="form1" runat="server">
    <table width="100%" border="0" cellpadding="2" cellspacing="1" class="border">
        <tr align="center">
            <td colspan="2" class="spacingtitle">
                <strong>邮件参数配置</strong>
            </td>
        </tr>
        <tr class="tdbg">
            <td class="tdbgleft" style="width: 200px;">
                <strong>发送人邮箱:<br />
                </strong>例：someone@163.com
            </td>
            <td>
                <asp:TextBox ID="txtMailFrom" runat="server" CssClass="inputtext" Width="400px" onfocus="this.style.backgroundColor='#d2e0f0';" onblur="this.style.backgroundColor='';"></asp:TextBox>
                <asp:CheckBox ID="chkCollocateCheckBox" runat="server" Checked="True" Text="自动配置邮件服务器信息" onclick="changeauto(this);" />
                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="txtMailFrom"
                    Display="Dynamic" ErrorMessage="不能为空！" ValidationGroup="Config"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr class="tdbg">
            <td style="width: 30%" class="tdbgleft">
                <strong>发送邮件服务器(SMTP)：</strong><br />
                用来发送邮件的SMTP服务器，如果你不清楚此参数含义，请联系你的空间商
            </td>
            <td>
                <asp:TextBox ID="txtMailServer" runat="server" CssClass="inputtext" Width="400px" onfocus="this.style.backgroundColor='#d2e0f0';" onblur="this.style.backgroundColor='';"></asp:TextBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtMailServer"
                    Display="Dynamic" ErrorMessage="不能为空！" ValidationGroup="Config"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr class="tdbg">
            <td class="tdbgleft">
                <strong>端口号：</strong><br />
                端口号必需是非负整正数，默认是25端口
            </td>
            <td>
                <asp:TextBox ID="txtPort" runat="server" CssClass="inputtext" Width="400px" onfocus="this.style.backgroundColor='#d2e0f0';" onblur="this.style.backgroundColor='';">25</asp:TextBox>
                <asp:CompareValidator ID="CompareValidator1" runat="server" ControlToValidate="txtPort"
                    Display="Dynamic" ErrorMessage="端口号必需是非负整正数！" Operator="GreaterThanEqual" Type="Integer"
                    ValueToCompare="0" ValidationGroup="Config"></asp:CompareValidator>
            </td>
        </tr>
        <tr class="tdbg">
            <td class="tdbgleft">
                <strong>此服务器要求安全连接(SSL)：</strong>
            </td>
            <td>
                <asp:CheckBox ID="chkSSL" runat="server" />
            </td>
        </tr>
        <tr class="tdbg">
            <td class="tdbgleft" colspan="2" style="width: 100%; text-align: center; padding: 5px">
                <br />
                <fieldset style="width: 95%;" class="tdbgleft">
                    <legend>身份验证</legend>
                    <table border="0" cellpadding="0" cellspacing="0" style="width: 100%; margin-top: 10px;
                        margin-bottom: 10px;">
                        <tr>
                            <td style="width: 3%">
                                <input id="radNone" name="radCredential" checked=true type="radio" runat="server" onclick="SelectCredential(this)" value="1" />
                            </td>
                            <td style="text-align: left">
                                无
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <input id="radBasic" name="radCredential" type="radio" runat="server" onclick="SelectCredential(this)" value="2" />
                            </td>
                            <td style="text-align: left">
                                基本
                            </td>
                        </tr>
                        <tr>
                            <td>
                            </td>
                            <td style="text-align: left">
                                如果您的电子邮件服务器要求在发送电子邮件时显式传入用户名和密码，请选择此选项。
                            </td>
                        </tr>
                        <tr>
                            <td>
                            </td>
                            <td style="text-align: left" id="TD1">
                                <asp:Panel ID="PalBasic" runat="server" Width="100%" Enabled="False">
                                    发件人的用户名:<asp:TextBox ID="txtMailServerUserName" runat="server"  CssClass="inputtext" Width="150px" onfocus="this.style.backgroundColor='#d2e0f0';" onblur="this.style.backgroundColor='';"></asp:TextBox><br />
                                    发件人的密 &nbsp;码:<asp:TextBox ID="txtMailServerPassWord" TextMode="password" runat="server"
                                         CssClass="inputtext" Width="150px" onfocus="this.style.backgroundColor='#d2e0f0';" onblur="this.style.backgroundColor='';"></asp:TextBox></asp:Panel>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <input id="radNTLM" name="radCredential" type="radio" runat="server" onclick="SelectCredential(this)" value="3" />
                            </td>
                            <td style="text-align: left">
                                NTLM (Windows 身份验证)
                            </td>
                        </tr>
                        <tr>
                            <td>
                            </td>
                            <td style="text-align: left">
                                如果您的电子邮件服务器位于局域网上，并且您使用 Windows 凭据连接到该服务器，请选择此选项。
                            </td>
                        </tr>
                    </table>
                </fieldset>
                <br />
                <br />
            </td>
        </tr>
        <tr class="tdbgbottom">
            <td colspan="2">
                <asp:Button ID="BtnSubmit" runat="server" Text="保存设置[S]" class="btnstyle_blue" Style="width: 90px;"
                    AccessKey="S" onmouseover="this.className='btnstyle_blue_over'" onmouseout="this.className='btnstyle_blue'"
                    OnClick="BtnSubmit_Click" />&nbsp;&nbsp;
                <input type="reset" name="ClearSiteInfo" value="重 填[R]" class="btnstyle_blue" id="btnSiteInfoReset"
                    accesskey="R" style="width: 70px;" runat="server" onmouseover="this.className='btnstyle_blue_over'"
                    onmouseout="this.className='btnstyle_blue'" />
            </td>
        </tr>
    </table>
    <p />
    <table width="100%" border="0" cellpadding="2" cellspacing="1" class="border">
        <tr align="center">
            <td colspan="2" class="spacingtitle">
                测试邮件配置
            </td>
        </tr>
        <tr class="tdbg">
            <td style="width: 30%; height: 48px; text-align: left" class="tdbgleft">
                <strong>&nbsp; &nbsp; &nbsp; EMAIL：</strong>
            </td>
            <td>
                <asp:TextBox ID="txtTestMail" runat="server" CssClass="inputtext" Width="400px" onfocus="this.style.backgroundColor='#d2e0f0';" onblur="this.style.backgroundColor='';"></asp:TextBox>
                <asp:Button ID="BtnTest" runat="server" Text="发送测试邮件" OnClick="BtnTest_Click" />                
                <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="txtTestMail"
                    Display="Dynamic" ErrorMessage="不能为空！" ValidationGroup="Test"></asp:RequiredFieldValidator>
            </td>
        </tr>
    </table>
    </form>
</body>
</html>
